<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Jqgrid extends CI_Controller {

	public function index() {
	    $action = $this->input->get('action', TRUE);
	    switch ($action) {
	        case 'simple':
	            $this->load->view('jqgrid/top');
	            $this->load->view('jqgrid/simple/index');
	            $this->load->view('jqgrid/bottom');
	            break;
	        default:
	            $this->load->view('jqgrid/top');
	            $this->load->view('jqgrid/simple/index');
	            $this->load->view('jqgrid/bottom');
	    }
	}
	
	public function simple() {
        $this->load->view('jqgrid/top');
        $this->load->view('jqgrid/simple/index');
        $this->load->view('jqgrid/bottom');
	}
	
	public function simpleJson() {
	    $v = [];
	    $v[0] = array('no'=>'1001', 'name'=>'zhangsan', 'sex'=>'M', 'age'=>18, 'grade'=>88);
	    $v[1] = array('no'=>'1002', 'name'=>'zhangsi', 'sex'=>'F', 'age'=>22, 'grade'=>60);
	    $v[2] = array('no'=>'1003', 'name'=>'wangwu', 'sex'=>'F', 'age'=>25, 'grade'=>55);
	    
	    $data['page']    = 1;
	    $data['records'] = 10;
	    $data['total']   = 1;
	    $data['rows']    = $v;
	    die(json_encode($data));
	}
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */